<?php
    require "./commonFunction.php";
	sleep(2);
    // header("Access-Control-Allow-Origin:http://192.168.206.10:8085");
    header("Access-Control-Allow-Origin:http://localhost:8085");
    header('Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept');
    if(isset($_GET['start'])){
        $result['code'] = 0;
        $result['data'] = "get请求返回的值:" .$_GET['start'];
        echo  json_encode($result);
    }else {
        if(isset($_POST['username']) && 
            isset($_POST['password'])){
            require "./extends/config.php";
            require "./extends/Model.class.php";
            $userModel = new Model('b_user');
            $username = $_POST['username'];
            $selectResult = $userModel->where("user_name='$username'")->select();
            if($selectResult){
                if($_POST['password'] == $selectResult[0]['user_password']){
                    unset($selectResult[0]['user_password']);
                    echoMessage(0, $selectResult[0]);
                }else {
                    echoMessage(2,"用户名或密码错误");
                }
            }else {
                echoMessage(1,"用户名不存在");
            }
        }else {
            echoMessage(3,"no post params");
        }
    }



